# langchain_ollama调用chat对话模型

from langchain_ollama import ChatOllama

question = input("请输入问题：") or "20字介绍北京"

chat_ollama = ChatOllama(
    model="qwen2.5:3b", 
    temperature=0.5, 
    num_predict=256)

messages = [
    ("system", "你是一个北京的导游."),
    ("human", question),
]

answer = chat_ollama.invoke(messages)

print("问:",question,"?\n答:", answer.content)